package com.example.citydev;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class Welcome extends Activity implements OnClickListener {
String username ="";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome);
		Bundle bundle = this.getIntent().getExtras();
		username= bundle.getString("user");
		final TextView Benvenuto = (TextView) findViewById(R.id.benvenuto);
		Benvenuto.setText("Ciao " + username + "\n Benvenuto.");
		Button button = (Button) findViewById(R.id.segnalazione);
		button.setOnClickListener(this);
		button = (Button) findViewById(R.id.progetti);
		button.setOnClickListener(this);

	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.segnalazione:
			final TextView user = (TextView) findViewById(R.id.benvenuto);
			Bundle bundleinvia = new Bundle();
			bundleinvia.putString("user", username);
			Intent form_intent = new Intent(getApplicationContext(), NuovaSegnalazione.class);
			form_intent.putExtras(bundleinvia);
			startActivity(form_intent);
			break;

		case R.id.progetti:
			// TODO
			break;

		}

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.welcome, menu);
		return true;
	}

}
